package com.mentalhealthplatform.teacherV2.dto;

import com.mentalhealthplatform.appModels.Assessment;
import lombok.Getter;
import lombok.Setter;

import java.time.LocalDateTime;
import java.util.UUID;

@Getter
@Setter
public class AssessmentDTO {

    private Long id;
    private int score;
    private String evaluation;
    private LocalDateTime submittedTime;
    private String studentName;
    private String studentNumber; // 添加 studentNumber 字段
    private String college;
    private String major;
    private String gender;
    private String grade;
    private UUID studentId;

    public AssessmentDTO(Long id, int score, String evaluation, LocalDateTime submittedTime,
                         String studentName, String studentNumber, String college, String major, String gender, String grade, UUID studentId) {
        this.id = id;
        this.score = score;
        this.evaluation = evaluation;
        this.submittedTime = submittedTime;
        this.studentName = studentName;
        this.studentNumber = studentNumber; // 设置 studentNumber 字段
        this.college = college;
        this.major = major;
        this.gender = gender;
        this.grade = grade;
        this.studentId = studentId;
    }

    public static AssessmentDTO convertToDTO(Assessment assessment) {
        return new AssessmentDTO(
                assessment.getId(),
                assessment.getScore(),
                assessment.getEvaluation(),
                assessment.getSubmittedTime(),
                assessment.getStudent().getName(),
                assessment.getStudent().getNumber(), // 获取 studentNumber
                assessment.getStudent().getCollege(),
                assessment.getStudent().getMajor(),
                assessment.getStudent().getGender(),
                assessment.getStudent().getGrade(),
                assessment.getStudent().getId()
        );
    }
}